{extend name="./oscshop/admin/view/public/base.html" /}
{block name="content"}
<div class="page-header">
	<h1>	
		{$breadcrumb1}
		<small>
			<i class="ace-icon fa fa-angle-double-right"></i>
			{$breadcrumb2}
		</small>
	</h1>
</div>
<form action="{:url('Contract/limit_add')}" method="post">
	<table class="table table-striped table-bordered table-hover">
		<thead>
		<tr>
			<th>
				<select name="time_id">
					<option value="">请选择关联值</option>
					{volist name='time' id='time'}
					<option value="{$time.id}">{:get_time_id_name($time.id)}</option>
					{/volist}
				</select>
				<input name="num" type="number" step="0.01" placeholder="输入限制值" value="" />
				<input name="desc" type="text" placeholder="输入注释" value="" />
				<button class="btn btn-primary">新增或修改</button>&nbsp;&nbsp;&nbsp;
			</th>
		</tr>
		</thead>
	</table>
</form>
<div class="row">
	<div class="col-xs-12">	
		<div class="table-responsive">
			<table class="table table-striped table-bordered table-hover">
				<thead>
					<tr>											
						<th>id</th>
						<th>关联值</th>
						<th>限制值</th>
						<th>注释</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
						{volist name="list" id="v"}
						<tr>						
							<td>{$v.id}</td>
							<td>{:get_time_id_name($v.time_id)}</td>
							<td>{$v.num}</td>
							<td>{$v.desc}</td>
							<td>
								<a class="delete btn btn-xs btn-danger" href='{:url("Contract/del",array("model"=>"limit","id"=>$v["id"]))}' >
									<i class="fa fa-trash bigger-120"></i>
								</a>
							</td>
						</tr>
						{/volist}	
				</tbody>
			</table>
		</div>
		{$page}
	</div>
</div>
{/block}
{block name="javascript"}
<script>	
$(function(){
   $("#search").click(function () {
        var url = $(this).attr('url');
        var query = $('.search-form').find('input,select').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
        query = query.replace(/^&/g, '');
        if (url.indexOf('?') > 0) {
            url += '&' + query;
        } else {
            url += '?' + query;
        }
        window.location.href = url;
    });	

      $("#search1").click(function () {
        var url = $(this).attr('url');
        var query = $('.search-form').find('input,select').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
        query = query.replace(/^&/g, '');
        if (url.indexOf('?') > 0) {
            url += '&' + query;
        } else {
            url += '?' + query;
        }
        //alert(url);
        window.location.href = url;
    });	
});
</script>
{/block}